# -*- encoding:utf-8 -*-
# !/usr/bin/env python
'''
    python-0820-01.py
    ======================
    @descript: 单线程程序
    @copyright:nnz
    @author:dln
    @date: 2021/8/20 10:24
    @version:v1.0
'''
import threading
import time
#
#
# class A:
#     def __init__(self,p_name,p_num):
#         self.__name=p_name
#         self.__num=p_num
#         pass
#     def start (self):
#         self.run()
#         pass
#     def run (self):
#         print('线程{}'.format(threading.currentThread().getName()))
#         for menthod in range(1,self.__num):
#             print('线程{}的值为{}'.format(threading.currentThread().getName(),menthod))
#             time.sleep(2)
#             pass
#         print('线程[{}]结束'.format(threading.currentThread().getName()))
#         pass
#     pass
#
# if __name__=='__main__':
#     print('线程{}开始'.format(threading.currentThread().getName()))
#     v_object=A('线程1',10)
#     v_object.start()
#     for menthod in range(1,10):
#         print('线程{}输出的值为{}'.format(threading.currentThread().getName(),menthod))
#         pass
#     print('线程{}结束'.format(threading.currentThread().getName()))
#     pass


class A:
    def __init__(self,p_name,p_num):
        self.v_name=p_name
        self.v_num=p_num
        pass
    def start(self):
        self.run()
        pass
    def run(self):
        print('线程{}'.format(threading.currentThread().getName()))
        for menthod in range(1,11):
            print('线程{}的值为{}'.format(threading.currentThread().getName(),menthod))
            pass
        print('线程{}结束'.format(threading.currentThread().getName()))
        pass
if __name__=='__min__':
    print('线程{}开始执行'.format(threading.currentThread().getName()))
    v_object=A('线程',11)
    v_object.start()
    for menthod in range(1,11):
        print('线程{}的值为{}'.format(threading.currentThread().getName(), menthod))
        pass
    print('线程{}结束'.format(threading.currentThread().getName()))
    pass

